import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import filters from '@/utils/filters'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import { setRem } from '@/utils/rem'
import '@/utils/tools'
import '@/permission'
setRem()
Vue.use(ElementUI)
Vue.config.productionTip = false

const requireComponent = require.context('./components', false, /\.vue$/)
requireComponent.keys().forEach((fileName) => {
  const componentConfig = requireComponent(fileName)
  const componentName = fileName.replace(/^\.\//, '').replace(/\.vue/, '')
  Vue.component(componentName, componentConfig.default || componentConfig)
})

Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

export default new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
